#include <iostream>

using namespace std;

int main(int argc, char* args[])
{
	const int MAX = 1000001;
	char str[MAX];
	scanf("%s", str);
	while (strlen(str) != 1 || str[0] != '.') {
		//for (int i = 0; i < MAX - 2; i += 2) {
		//	str[i] = 'a';
		//	str[i + 1] = 'b';
		//}
		//str[MAX - 1] = '\0';
		int len = strlen(str);
		int i = len;
		for (; i > 0; --i) {
			if (len % i == 0) {
				int eachLen = len / i;
				bool isEqual = true;
				for (int j = eachLen;j < len; j+= eachLen) {
					for (int k = 0; k < eachLen; k++) {
						if (str[j + k] != str[k]) {
							isEqual = false;
							break;
						}
					}
					if (!isEqual) 
						break;
				}
				if (isEqual) {
					break;
				}
			}
		}
		printf("%d\n", i);
		scanf("%s", str);
	}
	return 0;
}